﻿
@{
    ViewBag.Title = "KaoHeHuiZongDaBiao";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link rel="stylesheet" href="~/Template/ace_admin_v1.4.0/components/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css" />
<script src="~/Template/ace_admin_v1.4.0/components/bootstrap-datepicker/dist/js/bootstrap-datepicker.js"></script>
<script src="~/Template/ace_admin_v1.4.0/components/moment/moment.js"></script>
<div class="row" id="app">
    <div class="col-lg-12">
        <!--时间-->
        <div class="row">
            <div class="col-xs-12">
                <div class="form-horizontal" role="form">
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" data-rel="tooltip" title="哪个月的工作计划"> 所属时间 </label>
                        <div class="col-sm-5">
                            <div class="input-group">
                                <input class="form-control date-picker" readonly="readonly" type="text" data-date-format="yyyy-mm" id="sssj" />
                                <span class="input-group-addon">
                                    <i class="fa fa-calendar bigger-110"></i>
                                </span>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
        <!--工作计划列表-->
        <div class="row" id="gzjhlist">
            <div class="col-lg-12">
                <table class="table table-striped table-bordered table-hover">
                    <thead>
                        <tr>
                            <th class="center">
                                名称
                            </th>
                            <th></th>
                        </tr>
                    </thead>

                    <tbody>
                        <tr v-for="tr in gzjhlist">
                            <td class="center">
                                {{tr.mbmc}}
                            </td>
                            <td>

                                <div class="btn-group">
                                    <button data-toggle="dropdown" class="btn btn-primary btn-white dropdown-toggle btn-sm">
                                        操作
                                        <i class="ace-icon fa fa-angle-down icon-on-right"></i>
                                    </button>

                                    <ul class="dropdown-menu">
                                        <li>
                                            <a href="javascript:void(0)" v-on:click="ShowRenYuanList(tr.mbid)">查看</a>
                                        </li>
                                    </ul>
                                </div><!-- /.btn-group -->
                            </td>

                        </tr>

                    </tbody>
                </table>
            </div>
        </div>


        <!--工作计划详细信息-->
        <div class="row" id="gongzuojihuainfo" style="display: none">
            <div class="col-xs-12  widget-container-col">
                <!-- #section:custom/widget-box -->
                <div class="widget-box">
                    <div class="widget-header">
                        <h5 class="widget-title">编辑区</h5>

                        <!-- #section:custom/widget-box.toolbar -->
                        <div class="widget-toolbar">
                            <div class="widget-menu">
                                <a href="#" data-action="settings" data-toggle="dropdown">
                                    <i class="ace-icon fa fa-bars"></i>
                                </a>

                                <ul class="dropdown-menu dropdown-menu-right dropdown-light-blue dropdown-caret dropdown-closer">
                                    <li>
                                        <a data-toggle="tab" href="#dropdown1" v-on:click="ShowList()">返回列表</a>
                                    </li>

                                </ul>
                            </div>


                        </div>

                        <!-- /section:custom/widget-box.toolbar -->
                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div class="form-horizontal" role="form">
                                @*<button class="button" v-on:click="printdiv">打印</button>*@
                                <div class="form-group">
                                    <!--startprint-->
                                    <table class="table  table-bordered table-hover" id="table_print">
                                        <thead class="thin-border-bottom">
                                            <tr>
                                                <th style="width: 70px">
                                                    姓名
                                                </th>
                                                <th style="width: 170px">
                                                    科室
                                                </th>
                                                <th style="width: 100px">
                                                    职务
                                                </th>
                                                <template v-for="son in moban.DomainHuiZongSons">
                                                    <th style="width: 100px">{{son.gznr}}</th>
                                                </template>
                                                <th style="width: 100px">加分项</th>
                                                <th>临时工作</th>
                                                <th style="width: 70px;">
                                                    总分
                                                </th>
                                            </tr>
                                        </thead>
                                        <tbody>

                                            <tr v-for="son in defenlist">
                                                <td>
                                                    {{son.xingming}}
                                                </td>
                                                <td>
                                                    {{son.keshi}}
                                                </td>
                                                <td>
                                                    {{son.zhiwei}}
                                                </td>
                                                <template v-for="tr in son.Domain_DeFens">
                                                    <template v-for="mobanson in moban.DomainHuiZongSons">
                                                        <td v-if="mobanson.nrid==tr.nrid">
                                                            {{tr.defen}}
                                                        </td>
                                                    </template>
                                                </template>
                                                <td>{{son.fujiaxiang}}</td>
                                                <td v-html="son.linshigongzuo"></td>
                                                <td>
                                                    <a href="javascript:void(0)" v-on:click="ShowPingFenRenYuanList(son.mkhbid)">{{son.zongfen}}</a>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    <!--endprint-->
                                </div>

                            </div>
                        </div>
                    </div>
                </div>

                <!-- /section:custom/widget-box -->
            </div>

            <!-- /.span -->
        </div>
        <!--弹出框-->
        <div class="row">
            <div class="col-xs-12">
                <div id="dialog-linshigongzuo" class="hide">
                    <div class="row">
                        <div class="col-xs-12">
                            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th class="center">
                                            评价人姓名
                                        </th>
                                        <th>操作</th>
                                    </tr>
                                </thead>

                                <tbody>
                                    <tr v-for="tr in pingfenrenyuans">
                                        <td class="center">
                                            {{tr.XingMing}}
                                        </td>
                                        <td><a href="javascript:void(0)" v-on:click="p_DelPingFen(tr.pfusername)">驳回</a></td>

                                    </tr>
                                </tbody>
                            </table>
                        </div><!-- /.span -->
                    </div><!-- /.row -->


                </div><!-- #dialog-message -->
            </div>
        </div>
    </div>
</div>
<script src="~/Scripts/JsModel/Model_GongZuoJiHua.js"></script>
<script src="~/Scripts/JsModel/Model_KaoHeBiao.js"></script>
<script type="text/javascript">
    var vm = new Vue(
        {
            el: "#app",
            data: {
                gzjhlist: [],
                mbid: 0,
                moban: {},
                defenlist: [],
                pingfenrenyuans: []
            },
            mounted() {

                this.initPage();
            },
            methods: {
                initPage: function() {
                     $('.date-picker').datepicker({
                        language: "zh-CN",
                        autoclose: true,
                        format: "yyyy-mm",
                        minViewMode: 1
                    }).next().on(ace.click_event,
                        function() {
                            $(this).prev().focus();
                        });
                    $('[data-rel=tooltip]').tooltip();
                    var _self = this;
                    _self.p_Gets();
                },
                p_SouSuo: function () {

                },
                p_Gets: function() { //获取工作计划模版
                    var _self = this;
                    $.showloading();
                    axios.get("@Url.Action("GetGZJHs", "Review")").then((response) => {
                            _self.gzjhlist = [];
                            for (var i = 0; i < response.data.length; i++) {
                                _self.gzjhlist.push(response.data[i]);
                        }
                            $.closeloading();
                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                p_GetKaoHeBiao: function(mbid) { //通过模板获取审核人员的工作计划
                    var _self = this;

                    axios.get("@Url.Action("GetKaoHeMoBan", "Review")", { params: {mbid: mbid } }).then((response) => {
                        _self.moban = response.data;

                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                p_GetKaoHeBiaoInfo: function (mbid) {
                    var _self = this;
                    $.showloading();
                    var sssj = $("#sssj").val()
                    axios.get("@Url.Action("GetKaoHeDeFen", "Review")", { params: { mbid: mbid ,sssj:sssj} }).then((response) => {
                        _self.defenlist =[];
                        for (var i = 0; i < response.data.length; i++) {
                            _self.defenlist.push(response.data[i]);
                        }
                        $.closeloading();
                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                p_GetPingFenRenYuanList: function (mkhbid) {
                    var _self = this;
                    $.showloading();
                    _self.mkhbid = mkhbid;
                    axios.get("@Url.Action("GetPingFenRenYuanList", "Review")", { params: { mkhbid: mkhbid} }).then((response) => {
                        _self.pingfenrenyuans =[];
                            for (var i = 0; i < response.data.length; i++) {
                                _self.pingfenrenyuans.push(response.data[i]);
                        }
                        $.closeloading();
                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                p_DelPingFen: function ( username) {
                    var _self = this;
                    axios.get("@Url.Action("DelPingFenRenYuan", "Review")", { params: { mkhbid: _self.mkhbid,username:username} }).then((response) => {
                            bootbox.alert("清除成功", function () { _self.p_GetKaoHeBiaoInfo(_self.mbid)});
                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                ShowRenYuanList: function (mbid) {
                    var _self = this;
                    _self.mbid = mbid;

                    _self.p_GetKaoHeBiao(mbid);
                    _self.p_GetKaoHeBiaoInfo(mbid);
                    $("#gzjhlist").hide(function() {
                        $("#gongzuojihuainfo").show();
                    });
                },
                ShowList: function () {
                    var _self = this;
                    _self.defenlist = [];
                    _self.moban = {};
                    _self.mbid = 0;
                    $("#gongzuojihuainfo").hide(function() {
                        $("#gzjhlist").show();
                    });
                },
                ShowPingFenRenYuanList: function (mkhbid) {
                    var _self = this;
                    _self.p_GetPingFenRenYuanList(mkhbid);
                    var dialog = dialog_comm(false, "dialog-linshigongzuo", "评分人员列表", null, function () { }, true,600);
                },
                printdiv: function(printpage){
                    var newWindow = window.open(window.location.href,"_blank");//打印窗口要换成页面的url
                    var docStr = obj.innerHTML;
                    newWindow.document.write(docStr);
                    newWindow.document.close();
                    newWindow.print();
                    newWindow.close();
                }

            }
        });
</script>